# Kernel config based on: arch/arm/configs/p6601_defconfig
# Wiko U Feel is based on Tinno p6601

pkgname=linux-wiko-ufeel
pkgver=3.18.19
pkgrel=3
pkgdesc="Wiko U Feel kernel"
arch="armv7"
_carch="arm"
_flavor="wiko-ufeel"
url="https://wikomobile.com"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native"
makedepends="perl userspace-rcu sed installkernel bash gmp-dev bc linux-headers elfutils-dev devicepkg-dev gcc6"

## Compiler: GCC 6 (doesn't boot when compiled with newer versions)
if [ "${CC:0:5}" != "gcc6-" ]; then
	CC="gcc6-$CC"
	HOSTCC="gcc6-gcc"
	CROSS_COMPILE="gcc6-$CROSS_COMPILE"
fi

# Source
_repository="linux-wiko-ufeel"
_commit="225754d6fb494c6d5993f40451e415450337ba89"
_config="config-$_flavor.$arch"
source="
	$pkgname-$_commit.tar.gz::https://github.com/pmsourcedump/$_repository/archive/$_commit.tar.gz
	$_config
	00_disable_drvgen.patch
	01_add_decompiled_stock_dtb_dtsi.patch
	02_fix_various_include_directives_mt6735.patch
	03-workaround-loading-wifi-firmware-mt6735.patch
	gcc10-extern_YYLOC_global_declaration.patch
"
builddir="$srcdir/$_repository-$_commit"

prepare() {
	default_prepare
	. downstreamkernel_prepare
}

build() {
	unset LDFLAGS
	make ARCH="$_carch" CC="${CC:-gcc}" \
		KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
}

package() {
	downstreamkernel_package "$builddir" "$pkgdir" "$_carch" "$_flavor"
}


sha512sums="140e5d015ede0ebac771d4bb1e35e0133341dc05fe5c97ebc9f40142e889263722e40b7e7c99f865ad9890c879e85e2468d024d5cf5b8c4f79d74b678188bc6e  linux-wiko-ufeel-225754d6fb494c6d5993f40451e415450337ba89.tar.gz
178a679c2e088ad7589d477b904018f60e13dc3e1be14c3bdd90656a5ae998852cf2cfcb08a06176a4dde068fee3d86b7383644c1bde1c283f86e192ca0ffeb1  config-wiko-ufeel.armv7
8a04940e6f5424df67a3cc4c75dd19be1c9b560859e9db0ae67b766d52982a46156b601698afb80f90b9b99f63ef74e1f6147902b43ec97c25d2b75ba2f8d2b3  00_disable_drvgen.patch
e2b77554b0c22cacf9e011bd7ccd447c5d530fc23caa25416469ca3df6c2f6c0e11fb28cdf751ea8e3b35e629d8c68410ad4abf50f9fdbe493f6754810d9966d  01_add_decompiled_stock_dtb_dtsi.patch
1f6d7d043ee8556758e2475ca2d677abf1582f4329eb66cfcd6481a4b3216efd35a0f44d0483a8a3344bb4b5dd24d340327d9216f3069ed4b86e5bf8ffc5412b  02_fix_various_include_directives_mt6735.patch
02840e4c8d689d5507ab4e66e7c65940aa4335713b265ea745e93daf68cdf4c77aa497e253e6f0caa20fece37d176430d374ada1d9401b0ea552601ef0d7e312  03-workaround-loading-wifi-firmware-mt6735.patch
2b48f1bf0e3f70703d2cdafc47d5e615cc7c56c70bec56b2e3297d3fa4a7a1321d649a8679614553dde8fe52ff1051dae38d5990e3744c9ca986d92187dcdbeb  gcc10-extern_YYLOC_global_declaration.patch"
